package com.zhl.loop;

public class WhileTest4 {
    public static void main(String[] args) {
        double high = 8848860;
        int count = 0;
        double paperThickness = 0.1;
        //定义while循环，控制纸张进行折叠。
        while (paperThickness <= high) {
            paperThickness += paperThickness;
            count++;
        }
        System.out.println("需要折叠的次数是 " + count);
        System.out.println("最终纸张的厚度是 " + paperThickness);



        System.out.println("___________________________-");
        int count1 = 0;
        double paperThickness1 = 0.1;
        for (;paperThickness1 <=8848860;count1 ++){
            paperThickness1 += paperThickness1;
        }
        System.out.println("需要折叠的次数是 " + count1);
        System.out.println("最终纸张的厚度是 " + paperThickness1);
    }
}
